package com.atguigu.schedule.service.impl;

import com.atguigu.schedule.dao.SysUserDao;
import com.atguigu.schedule.dao.impl.SysUserDapImpl;
import com.atguigu.schedule.pojo.SysUser;
import com.atguigu.schedule.service.SysUserService;
import com.atguigu.schedule.util.MD5Util;

public class SysUserServiceimpl implements SysUserService {
    private  SysUserDao sysUserDao=new SysUserDapImpl();
    @Override
    public int regist(SysUser sysUser) {
        //将用户的明文密码转为秘文密码
        sysUser.setUser_pwd(MD5Util.encrypt(sysUser.getUser_pwd()));
        //存入数据库
        return sysUserDao.addSysUser(sysUser);
    }

    @Override
    public SysUser findByUsername(String username) {
       // 根据用户名查询用户信息
        return  sysUserDao.findByUsername(username);
    }
}
